home *** CD-ROM | disk | FTP | other *** search
- /* $VER: Majordomo_approve.thor 1.1 (1.5.97)
- **
- ** Author: Oliver Roberts
- ** E-Mail: Oliver@poboxes.com
- ** WWW: http://www.nanunanu.org/~oliver/
- **
- ** Brief Description:
- **
- ** Arexx script for Majordomo list owners. Allows automatic handling of
- ** the most common messages that Majordomo will send you which require
- ** approval
- **
- ** Must be started from THOR.
- */
-
- conf = 'EMail' /* e-mail conference name */
-
- /* Password configuration - entries should be in the following form */
-
- password.donut_makers = 'BigSecret'
-
- /********************* DO NOT MODIFY BELOW HERE *************************/
- options results
-
- thorport = address()
-
- if ~show('p', 'BBSREAD') then do
- address command
- "run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead"
- "WaitForPort BBSREAD"
- end
-
- address(thorport)
-
- CURRENTMSG stem MSG
- if(rc ~= 0) then
- do
- REQUESTNOTIFY TEXT '"No current message."' BT '"_Ok"'
- exit
- end
-
- bbs = MSG.BBSNAME
-
- address(bbsread)
-
- /* Get a unique message for the event */
-
- UNIQUEMSGFILE bbsname '"'bbs'"' stem UNIQUEFILE
- if(rc ~= 0) then goto quit
-
- /* Read the data on the message that is to be forwarded */
-
- READBRMESSAGE bbsname '"'MSG.BBSNAME'"' confname '"'MSG.CONFNAME'"' msgnr MSG.MSGNR headstem HEADTAGS textstem TEXTTAGS
- if(rc ~= 0) then goto quit
-
- /* Setup message variables */
-
- domain = right(HEADTAGS.FROMADDR,length(HEADTAGS.FROMADDR) - pos('@',HEADTAGS.FROMADDR))
- listname = left(word(HEADTAGS.SUBJECT,2),length(word(HEADTAGS.SUBJECT,2)))
-
- if (pos('@',listname) ~= 0) then do
- listname = left(listname,pos('@',listname)-1)
- end
-
- if (pos(':',listname) ~= 0) then do
- listname = left(listname,pos(':',listname)-1)
- end
-
- if (symbol('password.'listname) = "VAR") then do
- passwd = value('password.'listname)
- end
- else do
- passwd = ''
- end
-
- if (passwd = '') then do
- address(thorport)
- REQUESTSTRING TITLE '"Enter password:"' BT '" _Ok | _Cancel "' MAXCHARS 20
- if(rc ~= 0) then exit
- passwd = result
- end
-
- address(BBSREAD)
-
- /* Create message file */
-
- if(~open(fh, UNIQUEFILE.NAME, W)) then
- do
- address(thorport)
- REQUESTNOTIFY TEXT '"Unable to open file:' UNIQUEFILE.NAME '"' BT '"_Ok"'
- exit
- end
-
- /* Build the message */
-
- if (LEFT(HEADTAGS.SUBJECT,7) = 'BOUNCE ') then do
- toaddress = listname || '@' || domain
- call writeln(fh,'')
- call writeln(fh, 'Approved: ' || passwd)
- do n=1 to TEXTTAGS.TEXT.COUNT
- call writeln(fh, TEXTTAGS.TEXT.n)
- end
- end
-
- if (LEFT(HEADTAGS.SUBJECT,8) = 'APPROVE ') then do
- toaddress = 'majordomo@' || domain
- do n=1 to TEXTTAGS.TEXT.COUNT
- if ((compress(word(TEXTTAGS.TEXT.n,1),'09'x) = 'approve') & (word(TEXTTAGS.TEXT.n,2) = 'PASSWORD')) then do
- call writeln(fh, 'approve ' || passwd || ' ' || right(TEXTTAGS.TEXT.n,length(TEXTTAGS.TEXT.n) - pos('PASSWORD',TEXTTAGS.TEXT.n) - 8))
- end
- end
- end
-
- call close(fh)
-
- /* Post it */
-
- drop EVENT.
-
- EVENT.SUBJECT = 'Re: '||HEADTAGS.SUBJECT
- EVENT.TOADDR = toaddress
- EVENT.CONFERENCE = conf
- EVENT.MSGFILE = UNIQUEFILE.FILEPART
-
- WRITEBREVENT bbsname '"'bbs'"' event 0 stem EVENT
- if(rc ~= 0) then goto quit
-
- address(thorport)
-
- if(bbs ~= MSG.BBSNAME) then
- PACKEVENTS '"'bbs'"'
-
- exit
-
- quit:
- address(thorport)
- REQUESTNOTIFY TEXT '"'BBSREAD.LASTERROR'"' BT '"_Ok"'
- exit
-